	ORG	#8000
	DISP	#386D

ZAD_STA	EQU	#57FF
SYS_PER	EQU	#57FF-256-32

L48D0	EQU	SYS_PER
L48D1	EQU	SYS_PER+1
L48D2	EQU	SYS_PER+2
L48D4	EQU	SYS_PER+4
L48D5	EQU	SYS_PER+5
L4B89	EQU	SYS_PER+7
L4B8B	EQU	SYS_PER+9
L4B8D	EQU	SYS_PER+11
L4B8E	EQU	SYS_PER+12
L4FC4	EQU	SYS_PER+13
L4BF9	EQU	SYS_PER+14

L4DFF	EQU	ZAD_STA
L4DBD	EQU	ZAD_STA-#3F

	DI
	LD	HL,DATA
	LD	DE,SYS_PER
	LD	BC,13
	LDIR
	LD	(L4B89),SP
	LD	SP,L4DFF
	JP	L489D

DATA	DEFB	0,4,0,0,7,#15,0,0,0,0,0,5,7

L4860	LD	HL,#4000
	LD	DE,#4001
	LD	BC,4096
	LD	(HL),L
	LDIR
	LD	A,7
L4883	LD	HL,#5800
	LD	DE,#5801
	LD	BC,511
	LD	(HL),A
	LDIR
	INC	HL
	INC	DE
	LD	BC,256
	LD	(HL),L
	LDIR
	XOR	A
	OUT	(254),A
	RET

L489D	CALL	L4860
L48A0	LD	B,16
	CALL	L4A8E
	XOR	A
	LD	(L4FC4),A
	CALL	L4F8C
	CP	"Q"
	JP	Z,L4B83
	LD	HL,L4960
	LD	C,A
L48BA	LD	A,(HL)
	AND	A
	JR	Z,L48A0
	CP	C
	JR	Z,L48C6
	INC	HL
	INC	HL
	INC	HL
	JR	L48BA
L48C6	INC	HL
	LD	E,(HL)
	INC	HL
	LD	D,(HL)
	EX	DE,HL
	LD	DE,L48A0
	PUSH	DE
	JP	(HL)

L4960	DEFB	"M"
	DEFW	L499D
	DEFB	"H"
	DEFW	L4A6D
	DEFB	"A"
	DEFW	L4A60
	DEFB	"6"
	DEFW	L49B1
	DEFB	"7"
	DEFW	L49CE
	DEFB	#00

L499D	CALL	L4A7C
	LD	HL,TEXT
	CALL	L4AA3
	CALL	L4D67
	JR	C,L49AE
	LD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90
	BIT	0,(IY+48)
	LD	IY,#5C3A
	RET	NZ
	CP	#61
	RET	C
	SUB	#20
	RET

L4FC5	LD	A,#20
L4FC7	PUSH	HL
	PUSH	BC
	PUSH	DE
	PUSH	AF
	LD	HL,(L48D2)
	LD	A,L
	CP	#20
L4FD0	EQU	$-1
	JR	NC,L4FFB
	INC	L
	LD	(L48D2),HL
	DEC	L
	LD	A,H
	LD	C,L
	EX	DE,HL
	CALL	#E9F
	EX	DE,HL
	LD	A,E
	ADD	A,C
	LD	E,A
	POP	AF
	PUSH	AF
	LD	BC,#3C00
	LD	H,C
	LD	L,A
	ADD	HL,HL
	ADD	HL,HL
	ADD	HL,HL
	ADD	HL,BC
	LD	B,#08
L4FF4	LD	A,(HL)
L4FF5	NOP
	LD	(DE),A
	INC	HL
	INC	D
	DJNZ	L4FF4
L4FFB	POP	AF
	POP	DE
	POP	BC
	POP	HL
	RET

L5318	DEFB	#E0,#0A,#0E	; *** DISAS TABL ***
	DEFB	#0F,#96,#AF
	DEFB	#B4,#B9,#BE
	DEFB	#BD,#C5,#09
	DEFB	"L",#C4,#04
	DEFB	#C5,",",#85
	DEFB	#00,#08,#0C
	DEFB	"%","*","U"
	DEFB	"\","i","k"
	DEFB	#09,"R","E"
	DEFB	#D4,#A4,"/"
	DEFB	#09,"P","O"
	DEFB	#D0,#94,#9A
	DEFB	"R","E",#D4
	DEFB	"E","X",#D8
	DEFB	"J","P"," "
	DEFB	"(","K",#A9
	DEFB	"L","D"," "
	DEFB	"S","P",","
	DEFB	#CB,#09,"J"
	DEFB	#D0,"$",#C1
	DEFB	#D7,#BA,"J"
	DEFB	"P"," ",#D7
	DEFB	#A0,"O","U"
	DEFB	"T"," ","("
	DEFB	"V",")",","
	DEFB	#C1,"I","N"
	DEFB	" ","A",","
	DEFB	"(","V",#A9
	DEFB	"E","X"," "
	DEFB	"(","S","P"
	DEFB	")",",",#CB
	DEFB	"E","X"," "
	DEFB	"D","E",","
	DEFB	"H",#CC,"D"
	DEFB	#C9,"E",#C9
	DEFB	#09,"C","A"
	DEFB	"L",#CC,"$"
	DEFB	#C1,#D7,"7"
	DEFB	#09,"P","U"
	DEFB	"S",#C8,#94
	DEFB	#81,"C","A"
	DEFB	"L","L"," "
	DEFB	#D7,",",#81
	DEFB	#D6,#09,"R"
	DEFB	"S",#D4,#BA
	DEFB	"0",#B0,"0"
	DEFB	#B8,"1",#B0
	DEFB	"1",#B8,"2"
	DEFB	#B0,"2",#B8
	DEFB	"3",#B0,"3"
	DEFB	#B8,":","R"
	DEFB	"L",#C3,"R"
	DEFB	"R",#C3,"R"
	DEFB	#CC,"R",#D2
	DEFB	"S","L",#C1
	DEFB	"S","R",#C1
	DEFB	"S","L",#C9
	DEFB	"S","R",#CC
	DEFB	#01,#A0,#85
	DEFB	#09,"B","I"
	DEFB	#D4,#1C,#C5
	DEFB	#09,"R","E"
	DEFB	#D3,#1C,#C5
	DEFB	#09,"S","E"
	DEFB	#D4,#1C,#C5
	DEFB	#00,#B4,#BB
	DEFB	#C3,#D1,#DE
	DEFB	#E1,#E9,#F0
	DEFB	#1B,"L",#C4
	DEFB	"C",#D0,"I"
	DEFB	#CE,"O",#D4
	DEFB	#06,#9A,#C9
	DEFB	#C4,"I",#D2
	DEFB	"D",#D2,#00
	DEFB	#08,"%","2"
	DEFB	"a","k","o"
	DEFB	"s","x","6"
	DEFB	#09,"J",#D2
	DEFB	"$",#C1,#AA
	DEFB	#9A,"N","O"
	DEFB	#D0,"E","X"
	DEFB	" ","A","F"
	DEFB	",","A","F"
	DEFB	#A7,"D","J"
	DEFB	"N","Z"," "
	DEFB	#AA,"J","R"
	DEFB	" ",#AA,"7"
	DEFB	#09,"L",#C4
	DEFB	#0C,#C1,#D7
	DEFB	#01,"A","D"
	DEFB	"D"," ",#CB
	DEFB	#CC,#09,"L"
	DEFB	#C4,#BA,"("
	DEFB	"B","C",")"
	DEFB	",",#C1,"A"
	DEFB	",","(","B"
	DEFB	"C",#A9,"("
	DEFB	"D","E",")"
	DEFB	",",#C1,"A"
	DEFB	",","(","D"
	DEFB	"E",#A9,"("
	DEFB	"W",")",","
	DEFB	#CB,"K",","
	DEFB	"(","W",#A9
	DEFB	"(","W",")"
	DEFB	",",#C1,"A"
	DEFB	",","(","W"
	DEFB	#A9,"/",#09
	DEFB	"I","N",#C3
	DEFB	#8C,#09,"D"
	DEFB	"E",#C3,#8C
	DEFB	#09,"I","N"
	DEFB	#C3,#84,#09
	DEFB	"D","E",#C3
	DEFB	#84,#09,"L"
	DEFB	#C4,#04,#C1
	DEFB	#D6,#BA,"R"
	DEFB	"L","C",#C1
	DEFB	"R","R","C"
	DEFB	#C1,"R","L"
	DEFB	#C1,"R","R"
	DEFB	#C1,"D","A"
	DEFB	#C1,"C","P"
	DEFB	#CC,"S","C"
	DEFB	#C6,"C","C"
	DEFB	#C6,#09,"I"
	DEFB	#CE,#04,#C1
	DEFB	"(","C",#A9
	DEFB	#01,"O","U"
	DEFB	"T"," ","("
	DEFB	"C",#A9,#C4
	DEFB	"?",#01,"S"
	DEFB	"B","C"," "
	DEFB	#CB,#CC,#01
	DEFB	"A","D","C"
	DEFB	" ",#CB,#CC
	DEFB	#09,"L",#C4
	DEFB	"/",#01,"("
	DEFB	"W",#A9,#CC
	DEFB	#0C,#C1,"("
	DEFB	"W",#A9,#81
	DEFB	"N","E",#C7
	DEFB	#01,"R","E"
	DEFB	#D4,#17,#81
	DEFB	#CE,#81,#C9
	DEFB	#09,"I",#CD
	DEFB	#9A,#B0,#AD
	DEFB	#B1,#B2,">"
	DEFB	#8A,"R","R"
	DEFB	#C4,"R","L"
	DEFB	#C4,#09,"L"
	DEFB	#C4,#9A,"I"
	DEFB	",",#C1,"R"
	DEFB	",",#C1,"A"
	DEFB	",",#C9,"A"
	DEFB	",",#D2
L54EE	DEFB	6,#0F,#15,#1B
	DEFB	#22,"-",#C2
	DEFB	#C3,#C4,#C5
	DEFB	#C8,#CC,"("
	DEFB	"Q",#A9,#C1
	DEFB	"B",#C3,"D"
	DEFB	#C5,#CB,"S"
	DEFB	#D0,"B",#C3
	DEFB	"D",#C5,#CB
	DEFB	"A",#C6,#B0
	DEFB	#B1,#B2,#B3
	DEFB	#B4,#B5,#B6
	DEFB	#B7,"N",#DA
	DEFB	#DA,"N",#C3
	DEFB	#C3,"P",#CF
	DEFB	"P",#C5,#D0
	DEFB	#CD,"A","D"
	DEFB	"D"," ","A"
	DEFB	#AC,"A","D"
	DEFB	"C"," ","A"
	DEFB	#AC,"S","U"
	DEFB	"B",#A0,"S"
	DEFB	"B","C"," "
	DEFB	"A",#AC,"A"
	DEFB	"N","D",#A0
	DEFB	"X","O","R"
	DEFB	#A0,"O","R"
	DEFB	#A0,"C","P",#A0
L5544	DEFB	"H","A"
	DEFB	"L",#D4
L5548	DEFB	"H",#CC,"I",#D8
	DEFB	"I",#D9

L554E	LD	HL,(L4B8B)	; *** DISAS PROG ***
	PUSH	HL
	LD	HL,#0000
L5555	LD	(L48D2),HL
	PUSH	HL
	PUSH	BC
	CALL	L556C
	POP	BC
	POP	HL
	INC	H
	DJNZ	L5555
	POP	HL
	LD	(L4B8B),HL
	LD	DE,#0898
	JP	L4E63
L556C	XOR	A
	LD	HL,L48D0
	LD	(HL),A
	INC	HL
	LD	(HL),A
	INC	HL
	LD	(HL),A
	LD	A,#11
	LD	(L48D5),A
	LD	HL,(L4B8B)
	CALL	L4B60
	LD	A,(L48D2)
	INC	A
	LD	(L48D4),A
	LD	DE,#0000
	CALL	L55E4
	LD	A,(L48D4)
	LD	(L48D2),A
	LD	B,A
	LD	A,#10
	SUB	B
	JR	Z,L559C
	CALL	L55A7
L559C	LD	A,(L48D5)
	LD	(L48D2),A
	LD	B,A
	LD	A,#20
	SUB	B
	RET	Z
L55A7	LD	B,A
L55A8	CALL	L4FC5
	DJNZ	L55A8
	RET
L55AE	PUSH	HL
	LD	A,(L48D4)
	LD	(L48D2),A
	LD	HL,(L4B8B)
	LD	A,(HL)
	INC	HL
	LD	(L4B8B),HL
	PUSH	AF
	CALL	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IT	0,E
	RET	Z
	LD	A,#20
	JP	L56F3
L5685	LD	HL,L5544
L5688	BIT	3,E
	RES	3,E
	LD	A,#2C
	CALL	NZ,L56F3
L5691	LD	A,(HL)
	BIT	7,A
	RES	7,A
	PUSH	AF
	CALL	NC,L56DF
	INC	HL
	POP	AF
	JR	Z,L5691
	RET
L569F	RRA
L56A0	RRA
	RRA
	AND	#07
	LD	C,A
	LD	A,E
	AND	#07
L56A8	LD	B,A
	INC	B
L56AA	XOR	A
	CP	C
	CALL	L5688
	DEC	C
	DJNZ	L56AA
	RET
L56B3	RRA
	RRA
	RRA
	PUSH	HL
	LD	HL,L54EE
	PUSH	AF
	LD	A,E
	CALL	L5671
	POP	AF
	AND	#07
	LD	C,A
	CALL	L56A8
	POP	HL
	RET
L56C8	RRCA
	XOR	#04
	BIT	2,A
	JR	L56D1
L56CF	BIT	5,A
L56D1	RES	5,A
	LD	(L4B8E),A
	RET	NZ
	LD	A,E
	AND	#07
	LD	C,A
	LD	B,#00
	ADD	HL,BC
	RET
L56DF	CP	#4B
	JR	Z,L5733
	CP	#51
	JR	Z,L5741
	CP	#56
	JR	Z,L5702
	CP	#57
	JR	Z,L5719
	CP	#2A
	JR	Z,L5767
L56F3	PUSH	AF
	LD	A,(L48D5)
	LD	(L48D2),A
	INC	A
	LD	(L48D5),A
	POP	AF
	JP	L4FC7
L5702	CALL	L55AE
	PUSH	HL
	PUSH	AF
	LD	A,(L48D5)
	LD	(L48D2),A
	POP	AF
	CALL	L4AAF
	LD	A,(L48D2)
	LD	(L48D5),A
	POP	HL
	RET
L5719	CALL	L55AE
	PUSH	HL
	LD	L,A
	CALL	L55AE
	LD	H,A
	LD	A,(L48D5)
	LD	(L48D2),A
	CALL	L4B60
	LD	A,(L48D2)
	LD	(L48D5),A
	POP	HL
	RET
L5733	PUSH	HL
	PUSH	BC
	LD	HL,L5548
	LD	C,D
	LD	B,#03
	CALL	L56AA
	POP	BC
	POP	HL
	RET
L5741	CALL	L5733
	LD	A,D
	OR	A
	RET	Z
	LD	A,#2B
	CALL	L56F3
	LD	A,(L48D1)
	DEC	A
	JR	NZ,L5702
	PUSH	HL
	LD	A,(L48D5)
	LD	(L48D2),A
	LD	A,(L48D0)
	CALL	L4AAF
	LD	A,(L48D2)
	LD	(L48D5),A
	POP	HL
	RET
L5767	PUSH	DE
	CALL	L55AE
	LD	HL,(L4B8B)
	DEC	HL
	CP	#80
	JR	C,L578E
	LD	E,A
	LD	A,#FF
	SUB	E
	LD	E,A
	LD	D,#00
	OR	A
	SBC	HL,DE
L577D	LD	A,(L48D5)
	LD	(L48D2),A
	CALL	L4B60
	POP	DE
	LD	A,(L48D2)
	LD	(L48D5),A
	RET
L578E	INC	A
	LD	E,A
	LD	D,#00
	ADD	HL,DE
	JR	L577D
L5795	LD	HL,(L4B8B)
	LD	DE,#0000
L579B	LD	(L48D2),DE
	PUSH	DE
	PUSH	BC
	CALL	L57B3
	CALL	L4FC5
	POP	BC
	POP	DE
	INC	D
	INC	HL
	DJNZ	L579B
	LD	DE,#15E0
	JP	L4E63
L57B3	PUSH	HL
	CALL	L4B60
	LD	A,#08
	LD	(L48D2),A
	POP	HL
	PUSH	HL
	LD	A,(HL)
	CALL	L4AAF
	CALL	L4FC5
	CALL	L4FC7
	LD	A,#0E
	LD	(L48D2),A
	POP	HL
	PUSH	HL
	LD	E,(HL)
	INC	HL
	LD	D,(HL)
	EX	DE,HL
	CALL	L4ABC
	LD	A,(L48D2)
	LD	B,A
	LD	A,#14
	SUB	B
	LD	B,A
L57DE	CALL	L4FC5
	DJNZ	L57DE
	LD	A,#16
	LD	(L48D2),A
	POP	HL
	LD	A,(HL)
	CP	#80
	JR	C,L57F6
	LD	A,#2F
	LD	(L4FF5),A
	LD	A,(HL)
	AND	#7F
L57F6	CP	#20
	CALL	NC,L4FC7
	XOR	A
	LD	(L4FF5),A
	RET
